function getIntersectionByProperty(array1, array2, property) {
	  return array1.filter(item1 => {
		return array2.some(item2 => item2[property] === item1[property]);
	  });
}

export async function processKeyList(keyList, searchInfo, callback) {
  let result = [];
  for (let i = 0; i < keyList.length; i++) {
    result[i] = [];
  }
  
  for (let i = 0; i < keyList.length; i++) {
    let keyInfo = keyList[i];
    let promise;
    if (keyInfo.flag == false) continue;
    if (keyInfo.relation === 0) {
      promise = uniCloud.callFunction({
        name: "getAnd",
        data: {
          [keyInfo.keyName]: searchInfo[i]
        }
      }).then(res => {
        result[i] = res;
      });
      await promise; // 等待当前 callFunction 完成
    } else {
      promise = uniCloud.callFunction({
        name: "getOr",
        data: {
          [keyInfo.keyName]: searchInfo[i]
        }
      }).then(res => {
        result[i] = res;
      });
      await promise; // 等待当前 callFunction 完成
    }
  }
	let first = true;
    let mergeResult = [];
    for (let i = 0; i < keyList.length; i++) {
		if(keyList[i].flag == false)continue;
		if(first){
			mergeResult = result[i].result;
			first = false;
		}
		else {
			mergeResult = getIntersectionByProperty(mergeResult, result[i].result, '_id');
		}
	}
	console.log("testResult", result);
    callback(mergeResult); // 调用回调函数并传递结果
}
